# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Content.V2.Model.OrderLegacyPromotionBenefit do
  @moduledoc """


  ## Attributes

  *   `discount` (*type:* `GoogleApi.Content.V2.Model.Price.t`, *default:* `nil`) - The discount in the order price when the promotion is applied.
  *   `offerIds` (*type:* `list(String.t)`, *default:* `nil`) - The OfferId(s) that were purchased in this order and map to this specific benefit of the promotion.
  *   `subType` (*type:* `String.t`, *default:* `nil`) - Further describes the benefit of the promotion. Note that we will expand on this enumeration as we support new promotion sub-types. Acceptable values are: - "`buyMGetMoneyOff`" - "`buyMGetNMoneyOff`" - "`buyMGetNPercentOff`" - "`buyMGetPercentOff`" - "`freeGift`" - "`freeGiftWithItemId`" - "`freeGiftWithValue`" - "`freeOvernightShipping`" - "`freeShipping`" - "`freeTwoDayShipping`" - "`moneyOff`" - "`percentageOff`" - "`rewardPoints`" - "`salePrice`" 
  *   `taxImpact` (*type:* `GoogleApi.Content.V2.Model.Price.t`, *default:* `nil`) - The impact on tax when the promotion is applied.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Describes whether the promotion applies to products (e.g. 20% off) or to shipping (e.g. Free Shipping). Acceptable values are: - "`product`" - "`shipping`" 
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :discount => GoogleApi.Content.V2.Model.Price.t() | nil,
          :offerIds => list(String.t()) | nil,
          :subType => String.t() | nil,
          :taxImpact => GoogleApi.Content.V2.Model.Price.t() | nil,
          :type => String.t() | nil
        }

  field(:discount, as: GoogleApi.Content.V2.Model.Price)
  field(:offerIds, type: :list)
  field(:subType)
  field(:taxImpact, as: GoogleApi.Content.V2.Model.Price)
  field(:type)
end

defimpl Poison.Decoder, for: GoogleApi.Content.V2.Model.OrderLegacyPromotionBenefit do
  def decode(value, options) do
    GoogleApi.Content.V2.Model.OrderLegacyPromotionBenefit.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Content.V2.Model.OrderLegacyPromotionBenefit do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
